package org.example.algorithm.array;

public class FindArrMinSolution {

    public static void main(String[] args) {
        int[][] arr = {{1, 3, 5}, {2, 4, 2}};
        int[] res = findMinNum(arr);
        for (int num: res) {
            System.out.println(num);
        }
    }

    /**
     * @param arr
     * @return
     */
    public static int[] findMinNum(int[][] arr) {
        int[] res = new int[arr[0].length];
        for (int i=0;i<arr[0].length;i++) {
            int min = Integer.MAX_VALUE;
            for (int j=0;j<arr.length;j++) {
                if (arr[j][i] <= min) {
                    min = arr[j][i];
                }
            }
            res[i] = min;
        }
        return res;
    }
}
